<template>
  <swiper
    class="carousel"
    :style="{ height: height }"
    autoplay
    indicator-dots
    circular
  >
    <swiper-item v-for="item in banners" :key="item.id">
      <image @click="goGoods(item.id)" :src="item.imgUrl"></image>
    </swiper-item>
  </swiper>
</template>

<script>
export default {
  props: ["banners", "height"],
  methods: {
    goGoods(id) {
      uni.navigateTo({
        //保留当前页面，跳转到应用内的某个页面
        url: `/pages/goods/index?id=${id}`,
      });
    },
  },
};
</script>

<style scoped>
.carousel {
  height: 100%;
}
</style>